package com.gcc.service.impl;

import com.gcc.dao.UserDao;
import com.gcc.dao.impl.UserDaoImpl;
import com.gcc.pojo.User;
import com.gcc.service.UserService;

public class UserSeiviceImpl implements UserService {


    private UserDao userDao=new UserDaoImpl();

    @Override
    public void registarUser(User user) {
        userDao.saveUser(user);

    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean existUsername(String username) {
        if(userDao.queryUserByUsername(username)==null)
        {
            return false;
        }
        return true;
    }
}
